package com.study.s11.flyweight;

import com.study.s11.flyweight.model.Teacher;

public class TeacherMainClass {
	
	public static void main(String[] args) {
		
		//1、新建MyCharacter工厂
		TeacherFactory teacherFactory = new TeacherFactory();
		//2、从MyCharacter工厂取出MyCharacter对象
		Teacher teacher1 = teacherFactory.getTeacher("666");
		Teacher teacher2 = teacherFactory.getTeacher("777");
		Teacher teacher3 = teacherFactory.getTeacher("666");
		
		System.out.println(teacher1.getNumber());
		System.out.println(teacher2.getNumber());
		System.out.println(teacher3.getNumber());
		
		//判断对象是否相同
		if(teacher1 == teacher3) {
			System.out.println("对象相同");
		} else {
			System.out.println("对象不相同");
		}
	}
}
